class AddressEntity {
  List<Region> _province;
  List<Region> _city;
  List<Region> _area;

  List<Region> get province => _province;

  List<Region> get city => _city;

  List<Region> get area => _area;

  AddressEntity({List<Region> province, List<Region> city, List<Region> area}) {
    _province = province;
    _city = city;
    _area = area;
  }

  AddressEntity.fromJson(dynamic json) {
    if (json["province"] != null) {
      _province = [];
      json["province"].forEach((v) {
        _province.add(Region.fromJson(v));
      });
    }
    if (json["city"] != null) {
      _city = [];
      json["city"].forEach((v) {
        _city.add(Region.fromJson(v));
      });
    }
    if (json["area"] != null) {
      _area = [];
      json["area"].forEach((v) {
        _area.add(Region.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    if (_province != null) {
      map["province"] = _province.map((v) => v.toJson()).toList();
    }
    if (_city != null) {
      map["city"] = _city.map((v) => v.toJson()).toList();
    }
    if (_area != null) {
      map["area"] = _area.map((v) => v.toJson()).toList();
    }
    return map;
  }
}

class Region {
  String _regionCode;
  String _name;
  String _parentCode;

  String get regionCode => _regionCode;

  String get name => _name;

  String get parentCode => _parentCode;

  Region({String regionCode, String name, String parentCode}) {
    _regionCode = regionCode;
    _name = name;
    _parentCode = parentCode;
  }

  Region.fromJson(dynamic json) {
    _regionCode = json["regionCode"];
    _name = json["name"];
    _parentCode = json["parentCode"];
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["regionCode"] = _regionCode;
    map["name"] = _name;
    map["parentCode"] = _parentCode;
    return map;
  }
}
